<!--
作者：T先森
QQ：1379146389
官网：doic.cn
本免费开源使用，请遵循开源协议，勿用于商业转售、闭源改造。二次开发需保留版权声明与开源标识，衍生代码同样开源。有疑问可联系作者反馈。 
-->

<!DOCTYPE html>
<html>

<head>
    <title>爱看 - 图床云</title>
    <link rel="icon" href="https://doic.cn/d/p/108.png" type="image/x-icon">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.85, maximum-scale=1.0, user-scalable=0">
    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
 <style>
        body {
            font-family: 'Montserrat', sans-serif;
            background-color: #e6f7ff; /* 新的背景色，浅蓝色 */
            color: #333; /* 主要文字颜色为深色 */
            margin: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }


        h1 {
            color: #007acc; /* 标题颜色为深蓝色 */
            text-align: center;
            font-size: 2.5em;
            margin-bottom: 30px;
            letter-spacing: 2px;
        }


        p {
            font-size: 1.2em;
            color: #666; /* 段落文字颜色为灰色 */
            max-width: 800px;
            text-align: center;
            line-height: 1.8;
        }


       .button-container {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 20px;
            margin: 40px 0;
        }


        #file-input-label,
        button {
            background-color: #ff9900; /* 按钮颜色为橙色 */
            color: #fff;
            border: none;
            padding: 15px 30px;
            font-size: 1.2em;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }


        #file-input-label:hover,
        button:hover {
            background-color: #e68a00; /* 按钮悬停颜色为深橙色 */
        }


        #file-input {
            display: none;
        }


       .file-preview-container {
            text-align: center;
            margin-top: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加轻微阴影 */
        }


       .file-preview-container img,
       .file-preview-container video {
            max-width: 100%;
            max-height: 300px;
            margin-top: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }


       .progress-bar {
            width: 100%;
            background-color: #ddd; /* 进度条背景色为浅灰色 */
            border-radius: 8px;
            overflow: hidden;
            margin-top: 30px;
            display: none;
        }


       .progress-bar-inner {
            height: 30px;
            width: 0;
            background-color: #ff9900; /* 进度条填充颜色为橙色 */
            text-align: center;
            line-height: 30px;
            color: #fff;
            border-radius: 8px;
            font-size: 14px;
        }


       .info-text {
            text-align: center;
            margin-top: 30px;
            font-size: 12px;
            color: #666; /* 信息文本颜色为灰色 */
            position: fixed;
            bottom: 15px;
        }
    </style>

</head>

<body>
    <div class="container">
        <h1>AiKan TyunOS</h1>
        <p>畅享高效的图床服务，轻松管理图像与视频资源。</p>
        <form action="indeu.php" method="post" enctype="multipart/form-data">
            <div class="button-container">
                <label id="file-input-label">
                    <i class="fas fa-images"></i> 选择相册
                    <input type="file" name="files[]" id="file-input" accept="image/*,video/*" multiple>
                </label>
                <button type="submit" name="submit"><i class="fas fa-upload"></i> 确认上传</button>
            </div>
        </form>
        <div class="file-preview-container" id="preview-container">
            <div id="preview-content"></div>
        </div>
        <div class="progress-bar" id="progress-bar">
            <div class="progress-bar-inner" id="progress-bar-inner">0%</div>
        </div>
    </div>

    <script>
        const fileInput = document.getElementById('file-input');
        const previewContainer = document.getElementById('preview-container');
        const previewContent = document.getElementById('preview-content');
        const progressBar = document.getElementById('progress-bar');
        const progressBarInner = document.getElementById('progress-bar-inner');
        const MAX_FILE_SIZE = 100;

        fileInput.addEventListener('change', (e) => {
            previewContent.innerHTML = '';
            const files = e.target.files;
            let totalFileSize = 0;

            Array.from(files).forEach(file => {
                const fileSizeMB = file.size / (1024 * 1024);
                totalFileSize += fileSizeMB;
                if (totalFileSize > MAX_FILE_SIZE) {
                    alert('总文件大小不能超过 ' + MAX_FILE_SIZE + 'MB');
                    fileInput.value = '';
                    previewContainer.style.display = 'none';
                    return;
                }

                const reader = new FileReader();
                reader.onload = (event) => {
                    const fileType = file.type;
                    const previewItem = document.createElement('div');

                    if (fileType.startsWith('image/')) {
                        const img = document.createElement('img');
                        img.src = event.target.result;
                        previewItem.appendChild(img);
                    } else if (fileType.startsWith('video/')) {
                        const video = document.createElement('video');
                        video.src = event.target.result;
                        video.controls = true;
                        previewItem.appendChild(video);
                    }

                    const fileSizeText = document.createElement('div');
                    fileSizeText.textContent = `文件大小: ${fileSizeMB.toFixed(2)}MB`;
                    fileSizeText.style.fontSize = '12px';

                    const fileNameText = document.createElement('div');
                    fileNameText.textContent = `文件名称: ${file.name}`;
                    fileNameText.style.fontSize = '12px';

                    const fileInfoContainer = document.createElement('div');
                    fileInfoContainer.style.display = 'flex';
                    fileInfoContainer.style.alignItems = 'center';
                    fileInfoContainer.style.justifyContent = 'center';
                    const space = document.createTextNode('\u00A0\u00A0');
                    fileInfoContainer.appendChild(fileNameText);
                    fileInfoContainer.appendChild(space);
                    fileInfoContainer.appendChild(fileSizeText);

                    previewItem.appendChild(fileInfoContainer);
                    previewContent.appendChild(previewItem);
                };

                reader.readAsDataURL(file);
            });

            previewContainer.style.display = totalFileSize > 0? 'block' : 'none';
        });

        function startUpload() {
            const files = fileInput.files;
            const totalFiles = files.length;
            let uploadedFiles = 0;

            if (totalFiles === 0) return;

            progressBar.style.display = 'block';

            Array.from(files).forEach((file, index) => {
                const xhr = new XMLHttpRequest();
                xhr.open('POST', 'indeu.php', true);
                xhr.upload.addEventListener('progress', (e) => {
                    if (e.lengthComputable) {
                        const percentComplete = (e.loaded / e.total) * 100;
                        updateProgress((index + percentComplete / 100) / totalFiles * 100);
                    }
                });

                xhr.upload.addEventListener('load', () => {
                    uploadedFiles++;
                    if (uploadedFiles === totalFiles) {
                        updateProgress(100);
                        alert('文件上传成功');
                    }
                });

                const formData = new FormData();
                formData.append('files[]', file);

                xhr.send(formData);
            });
        }

        function updateProgress(percent) {
            progressBarInner.style.width = percent + '%';
            progressBarInner.textContent = percent.toFixed(2) + '%';
        }
    </script>
</body>

</html>

<div class="info-text">
            <a href="http://doic.cn" style="color: #aaa; text-decoration: none;">© 2023 TyunOS All Rights Reserved.</a>
    <a href="https://lanzouq.com/imrXC2mdsshg" style="color: #aaa; text-decoration: none;">开源下载</a>
</div>




<!--统计代码请勿删除--><script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?82d3850e9cffef7bdfde3db3e6e4b978";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id:"KFunBsxDl2bThYnS",ck:"KFunBsxDl2bThYnS"})</script>
